<?php
session_start();
if(! isset($_SESSION['id'])) {
    header('Location:index.html');
}
?>
<?php 
if($_SESSION['id']!=='92'){
header('Location:index.html');
}
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>公告管理</title>
    <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style>
        .div{
            position: relative;
            text-align: center;
            padding-left: 500px;
        }
        .font{
            font-size: 16px;
            font-weight: bold;;
        }
        form{
            font-weight:bold;
        }
    </style>
</head>
<body style="text-align: center">
<?php include ('guanl.php');
//1. 链接数据库
header("content-type:text/html;charset=utf8");
include('conn.php');
$id=$_GET['id'];
//2.执行sql
$sql_select = "select * from qing where id='$id'";
$stmt = mysqli_query($conn,$sql_select);
//    var_dump($stmt);
//    die();
$qing = mysqli_fetch_assoc($stmt); // 解析数据
?>
<h3>清人</h3>
<form   method="post" class="form-inline">

    <div class="form-group">
        
        <span class="font">周数:</span><input type="text" name="zhou" class="form-control" ><br><br>
        <span class="font">时间:</span><input type="text" name="ss" class="form-control" value="<?php echo 
$time = date('Y-m-d-h:i:s', time());?>">
<br><br>
        <span class="font">名单:</span><textarea  name="md" id="" class="form-control" cols="30" rows="10"><?php echo $qing['md'];?></textarea>
        </span>
<br><br>
        
       


      
        <a href="main.php" class="btn btn-success">返回</a>
        <input type="submit" value="确定" class="btn btn-primary">
        <input type="reset" value="重置" class="btn btn-warning">
    </div>


</form>
 
<?php
if($_SERVER["REQUEST_METHOD"]=="POST") {
include('conn.php');
    $zhou = $_POST['zhou'];
    $ss= $_POST['ss'];
    $md = $_POST['md'];
    
    $sql = "insert into qing (zhou,ss,md) values ('$zhou', '$ss','$md')";
    $rw = mysqli_query($conn, $sql);
    if ($rw ) {
          echo "<script>alert('已提交！请返回主页查看');</script>";
    } else {
        echo "<script>alert('提交失败');</script>";
    }
 header("refresh:0.5;url=main.php");
}
?>
</body>
</html>